package com.edu.exam.enums.grading;

/**
 * 审计节点类型枚举
 */
public enum AuditNodeType {
    START("START", "开始节点"),
    END("END", "结束节点"),
    DECISION("DECISION", "决策节点"),
    APPROVAL("APPROVAL", "审批节点"),
    NOTIFICATION("NOTIFICATION", "通知节点"),
    AUTOMATION("AUTOMATION", "自动化节点"),
    PARALLEL("PARALLEL", "并行节点"),
    MERGE("MERGE", "合并节点");

    private final String code;
    private final String description;

    AuditNodeType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static AuditNodeType fromCode(String code) {
        for (AuditNodeType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown audit node type code: " + code);
    }

    @Override
    public String toString() {
        return description;
    }
}